import {defineConfig, presetAttributify, presetUno} from 'unocss'
import presetRemToPx from '@unocss/preset-rem-to-px'

const marginInfo = {
    t: 'top',
    b: 'bottom',
    l: 'left',
    r: 'right'
}
export default defineConfig({
    presets: [presetRemToPx({baseFontSize: 4}), presetAttributify(), presetUno()],
    rules: [
        // [/^m([tblr])-([\.\d]+)$/, ([, m, num]) => ({[`margin-${marginInfo[m]}`]: `${num}px`})],
        // [/^mx-([\.\d]+)$/, ([, num]) => ({'margin-left': `${num}px`, 'margin-right': `${num}px`})],
        // [/^my-([\.\d]+)$/, ([, num]) => ({'margin-top': `${num}px`, 'margin-bottom': `${num}px`})],
        // [/^p([tblr])-([\.\d]+)$/, ([, m, num]) => ({[`padding-${marginInfo[m]}`]: `${num}px`})],
        // [/^px-([\.\d]+)$/, ([, num]) => ({'padding-left': `${num}px`, 'padding-right': `${num}px`})],
        // [/^py-([\.\d]+)$/, ([, num]) => ({'padding-top': `${num}px`, 'padding-bottom': `${num}px`})],
        // [/^w-([\.\d]+)$/, ([, num]) => ({'width': `${num}px`})],
    ]
})
